
/**
** \file       rule_element.c
**
** \brief      this function parse the element rule
**
** \author     Ben M'rad Hanna, Laterem Hamza, Boillot Ulysse, De Olivera
**             Guillaume and Nguyen Viet Dung
**
** \version    1.0
**
** \date       26 Novembre 2010
**
*/

#include "rules.h"

s_element             *rule_element(s_element     *element)
{
  if (g_data->lexer == NULL)
    return (NULL);

  if (g_data->lexer->token->type == TOKEN_WORD)
  {
    element->word = calloc(1, sizeof (s_word));
    element->word->word = calloc(1, strlen(g_data->lexer->token->id) + 1);
    element->word->word = strcpy(element->word->word, g_data->lexer->token->id);
    g_data->lexer = g_data->lexer->next;

    return (element);
  }

  return (NULL);
}
